Fix double-escaping on login/logout return page
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
1 <?php
2 # Generic PHPTal (http://phptal.sourceforge.net/) skin
3 # Based on Brion's smarty skin
4 # Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
5 #
6 # Todo: Needs some serious refactoring into functions that correspond
7 # to the computations individual esi snippets need. Most importantly no body
8 # parsing for most of those of course.
9 #
10 # Set this in LocalSettings to enable phptal:
11 # set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
12 # $wgUsePHPTal = true;
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # http://www.gnu.org/copyleft/gpl.html
28
29 require_once "PHPTAL.php";
30
31 class MediaWiki_I18N extends PHPTAL_I18N
32 {
33 var $_context = array();
34
35 function set($varName, $value) {
36 $this->_context[$varName] = $value;
37 }
38
39 function translate($value) {
40 $value = wfMsg( $value );
41 // interpolate variables
42 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
43 list($src, $var) = $m;
44 $varValue = @$this->_context[$var];
45 $value = str_replace($src, $varValue, $value);
46 }
47 return $value;
48 }
49 }
50
51 class SkinPHPTal extends Skin {
52 var $template;
53
54 function initPage( &$out ) {
55 parent::initPage( $out );
56 $this->skinname = "davinci";
57 $this->template = "xhtml_slim";
58 }
59
60 function outputPage( &$out ) {
61 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
62 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
63 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
64 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
65
66 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
67
68 $this->initPage( $out );
69 $tpl = new PHPTAL($this->template . '.pt', 'templates');
70
71 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
72 $tpl->setTranslator(new MediaWiki_I18N());
73 #}
74
75 $this->thispage = $wgTitle->getPrefixedDbKey();
76 $this->thisurl = $wgTitle->getPrefixedURL();
77 $this->loggedin = $wgUser->getID() != 0;
78 $this->username = $wgUser->getName();
79 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
80 $this->userpageurl = $this->makeUrl($this->userpage);
81
82 if( $this->loggedin ) {
83 $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
84 $this->usercsse = htmlspecialchars($this->usercss);
85 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
86 $this->userjse = htmlspecialchars($this->userjs);
87 } else {
88 $this->usercss = $this->usercsse = $this->userjs = $this->userjse = false;
89 }
90 $this->titletxt = $wgTitle->getPrefixedText();
91
92 $tpl->set( "title", $wgOut->getPageTitle() );
93 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
94
95 $tpl->setRef( "thispage", &$this->thispage );
96 $subpagestr = $this->subPageSubtitle();
97 $tpl->set(
98 "subtitle", !empty($subpagestr)?
99 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
100 $out->getSubtitle()
101 );
102 $tpl->set( 'catlinks', $this->getCategories());
103 if( $wgOut->isSyndicated() ) {
104 $feeds = array();
105 foreach( $wgFeedClasses as $format => $class ) {
106 $feeds[$format] = array(
107 'text' => $format,
108 'href' => $wgRequest->appendQuery( "feed=$format" ),
109 'ttip' => wfMsg('tooltip-'.$format)
110 );
111 }
112 $tpl->setRef( 'feeds', &$feeds );
113 }
114 $tpl->setRef( 'mimetype', &$wgMimeType );
115 $tpl->setRef( 'charset', &$wgOutputEncoding );
116 $tpl->set( 'headlinks', $out->getHeadLinks() );
117 $tpl->setRef( 'skinname', &$this->skinname );
118 $tpl->setRef( "loggedin", &$this->loggedin );
119 /* XXX currently unused, might get useful later
120 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
121 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
122 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
123 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
124 $tpl->set( "helppage", wfMsg('helppage'));
125 $tpl->set( "sysop", $wgUser->isSysop() );
126 */
127 $tpl->set( "searchaction", $this->escapeSearchLink() );
128 $tpl->setRef( "stylepath", &$wgStylePath );
129 $tpl->setRef( "logopath", &$wgLogo );
130 $tpl->setRef( "lang", &$wgLanguageCode );
131 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
132 $tpl->set( "rtl", $wgLang->isRTL() );
133 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
134 $tpl->setRef( "username", &$this->username );
135 $tpl->setRef( "userpage", &$this->userpage);
136 $tpl->setRef( "userpageurl", &$this->userpageurl);
137 $tpl->setRef( "usercss", &$this->usercss);
138 $tpl->setRef( "usercsse", &$this->usercsse);
139 $tpl->setRef( "userjs", &$this->userjs);
140 $tpl->setRef( "userjse", &$this->userjse);
141 if( $wgUser->getNewtalk() ) {
142 $usertitle = Title::newFromText( $this->userpage );
143 $usertalktitle = $usertitle->getTalkPage();
144 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
145
146 $ntl = wfMsg( "newmessages",
147 $this->makeKnownLink(
148 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
149 . ":" . $this->username,
150 wfMsg("newmessageslink") )
151 );
152 }
153 } else {
154 $ntl = "";
155 }
156
157 $tpl->setRef( "newtalk", &$ntl );
158 $tpl->setRef( "skin", &$this);
159 $tpl->set( "logo", $this->logoText() );
160 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
161 if ( !$wgDisableCounters ) {
162 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
163 if ( $viewcount ) {
164 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
165 }
166 }
167 $tpl->set('lastmod', $this->lastModified());
168 $tpl->set('copyright',$this->getCopyright());
169 }
170 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
171 $tpl->set( "poweredbyico", $this->getPoweredBy() );
172 $tpl->set( "disclaimer", $this->disclaimerLink() );
173 $tpl->set( "about", $this->aboutLink() );
174
175 $tpl->setRef( "debug", &$out->mDebugtext );
176 $tpl->set( "reporttime", $out->reportTime() );
177
178 $tpl->setRef( "bodytext", &$out->mBodytext );
179
180 $language_urls = array();
181 foreach( $wgOut->getLanguageLinks() as $l ) {
182 $nt = Title::newFromText( $l );
183 $language_urls[] = array('href' => $nt->getFullURL(),
184 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
185 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
186 }
187 if(count($language_urls)) {
188 $tpl->setRef( 'language_urls', &$language_urls);
189 } else {
190 $tpl->set('language_urls', false);
191 }
192 $tpl->set('personal_urls', $this->buildPersonalUrls());
193 $content_actions = $this->buildContentActionUrls();
194 $tpl->setRef('content_actions', &$content_actions);
195 // XXX: attach this from javascript, same with section editing
196 if(isset($content_actions['edit']['href']) &&
197 !(isset($content_actions['edit']['class']) && $content_actions['edit']['class'] != '') &&
198 $wgUser->getOption("editondblclick") )
199 {
200 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
201 } else {
202 $tpl->set('body-ondblclick', '');
203 }
204 $tpl->set( "nav_urls", $this->buildNavUrls() );
205
206 // execute template
207 $res = $tpl->execute();
208 // result may be an error
209 if (PEAR::isError($res)) {
210 echo $res->toString(), "\n";
211 } else {
212 echo $res;
213 }
214
215 }
216
217 # build array of urls for personal toolbar
218 function buildPersonalUrls() {
219 /* set up the default links for the personal toolbar */
220 global $wgShowIPinHeader;
221 $personal_urls = array();
222 if ($this->loggedin) {
223 $personal_urls['userpage'] = array(
224 'text' => $this->username,
225 'href' => &$this->userpageurl,
226 'ttip' => wfMsg('tooltip-userpage'),
227 'akey' => wfMsg('accesskey-userpage')
228 );
229 $personal_urls['mytalk'] = array(
230 'text' => wfMsg('mytalk'),
231 'href' => $this->makeTalkUrl($this->userpage),
232 'ttip' => wfMsg('tooltip-mytalk'),
233 'akey' => wfMsg('accesskey-mytalk')
234 );
235 $personal_urls['preferences'] = array(
236 'text' => wfMsg('preferences'),
237 'href' => $this->makeSpecialUrl('Preferences'),
238 'ttip' => wfMsg('tooltip-preferences'),
239 'akey' => wfMsg('accesskey-preferences')
240 );
241 $personal_urls['watchlist'] = array(
242 'text' => wfMsg('watchlist'),
243 'href' => $this->makeSpecialUrl('Watchlist'),
244 'ttip' => wfMsg('tooltip-watchlist'),
245 'akey' => wfMsg('accesskey-watchlist')
246 );
247 $personal_urls['mycontris'] = array(
248 'text' => wfMsg('mycontris'),
249 'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
250 'ttip' => wfMsg('tooltip-mycontris'),
251 'akey' => wfMsg('accesskey-mycontris')
252 );
253 $personal_urls['logout'] = array(
254 'text' => wfMsg('userlogout'),
255 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl),
256 'ttip' => wfMsg('tooltip-logout'),
257 'akey' => wfMsg('accesskey-logout')
258 );
259 } else {
260 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
261 $personal_urls['anonuserpage'] = array(
262 'text' => $this->username,
263 'href' => $this->makeUrl($this->userpage),
264 'ttip' => wfMsg('tooltip-anonuserpage'),
265 'akey' => wfMsg('accesskey-anonuserpage')
266 );
267 $personal_urls['anontalk'] = array(
268 'text' => wfMsg('anontalk'),
269 'href' => $this->makeTalkUrl($this->userpage),
270 'ttip' => wfMsg('tooltip-anontalk'),
271 'akey' => wfMsg('accesskey-anontalk')
272 );
273 $personal_urls['anonlogin'] = array(
274 'text' => wfMsg('userlogin'),
275 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
276 'ttip' => wfMsg('tooltip-login'),
277 'akey' => wfMsg('accesskey-login')
278 );
279 } else {
280
281 $personal_urls['login'] = array(
282 'text' => wfMsg('userlogin'),
283 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
284 'ttip' => wfMsg('tooltip-login'),
285 'akey' => wfMsg('accesskey-login')
286 );
287 }
288 }
289
290 return $personal_urls;
291 }
292
293 # an array of edit links by default used for the tabs
294 function buildContentActionUrls () {
295 global $wgTitle, $wgUser, $wgRequest;
296 $action = $wgRequest->getText( 'action' );
297 $oldid = $wgRequest->getVal( 'oldid' );
298 $diff = $wgRequest->getVal( 'diff' );
299 $content_actions = array();
300
301 $iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
302 if( $iscontent) {
303
304 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : '',
305 'text' => wfMsg('article'),
306 'href' => $this->makeArticleUrl($this->thispage),
307 'ttip' => wfMsg('tooltip-article'),
308 'akey' => wfMsg('accesskey-article'));
309
310 /* set up the classes for the talk link */
311 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : '');
312 $talktitle = Title::newFromText( $this->titletxt );
313 $talktitle = $talktitle->getTalkPage();
314 $this->checkTitle(&$talktitle, &$this->titletxt);
315 if($talktitle->getArticleId() != 0) {
316 $content_actions['talk'] = array(
317 'class' => $talk_class,
318 'text' => wfMsg('talk'),
319 'href' => $this->makeTalkUrl($this->titletxt),
320 'ttip' => wfMsg('tooltip-talk'),
321 'akey' => wfMsg('accesskey-talk')
322 );
323 } else {
324 $content_actions['talk'] = array(
325 'class' => $talk_class?$talk_class.' new':'new',
326 'text' => wfMsg('talk'),
327 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
328 'ttip' => wfMsg('tooltip-talk'),
329 'akey' => wfMsg('accesskey-talk')
330 );
331 }
332
333 if ( $wgTitle->userCanEdit() ) {
334 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
335 $content_actions['edit'] = array(
336 'class' => ($action == 'edit' or $action == 'submit') ? 'selected' : '',
337 'text' => wfMsg('edit'),
338 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
339 'ttip' => wfMsg('tooltip-edit'),
340 'akey' => wfMsg('accesskey-edit')
341 );
342 } else {
343 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
344 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : '',
345 'text' => wfMsg('viewsource'),
346 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
347 'ttip' => wfMsg('tooltip-viewsource'),
348 'akey' => wfMsg('accesskey-viewsource'));
349 }
350
351 if ( $wgTitle->getArticleId() ) {
352
353 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : '',
354 'text' => wfMsg('history_short'),
355 'href' => $this->makeUrl($this->thispage, 'action=history'),
356 'ttip' => wfMsg('tooltip-history'),
357 'akey' => wfMsg('accesskey-history'));
358
359 # XXX: is there a rollback action anywhere or is it planned?
360 # Don't recall where i got this from...
361 /*if( $wgUser->getNewtalk() ) {
362 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : '',
363 'text' => wfMsg('rollback_short'),
364 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
365 'ttip' => wfMsg('tooltip-rollback'),
366 'akey' => wfMsg('accesskey-rollback'));
367 }*/
368
369 if($wgUser->isSysop()){
370 if(!$wgTitle->isProtected()){
371 $content_actions['protect'] = array(
372 'class' => ($action == 'protect') ? 'selected' : '',
373 'text' => wfMsg('protect'),
374 'href' => $this->makeUrl($this->thispage, 'action=protect'),
375 'ttip' => wfMsg('tooltip-protect'),
376 'akey' => wfMsg('accesskey-protect')
377 );
378
379 } else {
380 $content_actions['unprotect'] = array(
381 'class' => ($action == 'unprotect') ? 'selected' : '',
382 'text' => wfMsg('unprotect'),
383 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
384 'ttip' => wfMsg('tooltip-protect'),
385 'akey' => wfMsg('accesskey-protect')
386 );
387 }
388 $content_actions['delete'] = array(
389 'class' => ($action == 'delete') ? 'selected' : '',
390 'text' => wfMsg('delete'),
391 'href' => $this->makeUrl($this->thispage, 'action=delete'),
392 'ttip' => wfMsg('tooltip-delete'),
393 'akey' => wfMsg('accesskey-delete')
394 );
395 }
396 if ( $wgUser->getID() != 0 ) {
397 if ( $wgTitle->userCanEdit()) {
398 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : '',
399 'text' => wfMsg('move'),
400 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
401 'ttip' => wfMsg('tooltip-move'),
402 'akey' => wfMsg('accesskey-move'));
403 } else {
404 $content_actions['move'] = array('class' => 'inactive',
405 'text' => wfMsg('move'),
406 'href' => false,
407 'ttip' => wfMsg('tooltip-nomove'),
408 'akey' => false);
409
410 }
411 }
412 } else {
413 //article doesn't exist or is deleted
414 if($wgUser->isSysop()){
415 if( $n = $wgTitle->isDeleted() ) {
416 $content_actions['delete'] = array(
417 'class' => '',
418 'text' => wfMsg( "undelete_short", $n ),
419 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
420 'ttip' => wfMsg('tooltip-undelete', $n),
421 'akey' => wfMsg('accesskey-undelete')
422 );
423 }
424 }
425 }
426
427 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
428 if( !$wgTitle->userIsWatching()) {
429 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : '',
430 'text' => wfMsg('watch'),
431 'href' => $this->makeUrl($this->thispage, 'action=watch'),
432 'ttip' => wfMsg('tooltip-watch'),
433 'akey' => wfMsg('accesskey-watch'));
434 } else {
435 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : '',
436 'text' => wfMsg('unwatch'),
437 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
438 'ttip' => wfMsg('tooltip-unwatch'),
439 'akey' => wfMsg('accesskey-unwatch'));
440
441 }
442 }
443 } else {
444 /* show special page tab */
445
446 $content_actions['article'] = array('class' => 'selected',
447 'text' => wfMsg('specialpage'),
448 'href' => false,
449 'ttip' => wfMsg('tooltip-specialpage'),
450 'akey' => false);
451 }
452
453 return $content_actions;
454 }
455
456 # build array of common navigation links
457 function buildNavUrls () {
458 global $wgTitle, $wgUser, $wgRequest;
459 global $wgSiteSupportPage;
460
461 $action = $wgRequest->getText( 'action' );
462 $oldid = $wgRequest->getVal( 'oldid' );
463 $diff = $wgRequest->getVal( 'diff' );
464 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
465 $nav_urls = array();
466 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
467 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
468 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
469 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
470 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : '';
471 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : '';
472 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
473 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
474 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
475 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
476 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
477 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
478 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
479
480
481 $id=User::idFromName($wgTitle->getText());
482 $ip=User::isIP($wgTitle->getText());
483
484 if($id || $ip) { # both anons and non-anons have contri list
485 $nav_urls['contributions'] = array(
486 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
487 );
488 }
489 if ( 0 != $wgUser->getID() ) { # show only to signed in users
490 if($id) { # can only email non-anons
491 $nav_urls['emailuser'] = array(
492 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
493 );
494 }
495 }
496
497
498 return $nav_urls;
499 }
500
501 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
502 $title = Title::makeTitle( NS_SPECIAL, $name );
503 $this->checkTitle(&$title, &$name);
504 return $title->getLocalURL( $urlaction );
505 }
506 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
507 $title = Title::newFromText( $name );
508 $title = $title->getTalkPage();
509 $this->checkTitle(&$title, &$name);
510 return $title->getLocalURL( $urlaction );
511 }
512 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
513 $title = Title::newFromText( $name );
514 $title= $title->getSubjectPage();
515 $this->checkTitle(&$title, &$name);
516 return $title->getLocalURL( $urlaction );
517 }
518 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
519 $title = Title::newFromText( wfMsg($name) );
520 $this->checkTitle(&$title, &$name);
521 return $title->getLocalURL( $urlaction );
522 }
523 /*static*/ function makeUrl ( $name, $urlaction='' ) {
524 $title = Title::newFromText( $name );
525 $this->checkTitle(&$title, &$name);
526 return $title->getLocalURL( $urlaction );
527 }
528
529 # make sure we have some title to operate on, mind the '&'
530 /*static*/ function checkTitle ( &$title, &$name ) {
531 if(!is_object($title)) {
532 $title = Title::newFromText( $name );
533 if(!is_object($title)) {
534 $title = Title::newFromText( '<error: link target missing>' );
535 }
536 }
537 }
538
539
540 }
541
542 class SkinDaVinci extends SkinPHPTal {
543 function initPage( &$out ) {
544 SkinPHPTal::initPage( $out );
545 $this->skinname = "davinci";
546 }
547 }
548
549 class SkinMono extends SkinPHPTal {
550 function initPage( &$out ) {
551 SkinPHPTal::initPage( $out );
552 $this->skinname = "mono";
553 }
554 }
555
556 class SkinMonoBook extends SkinPHPTal {
557 function initPage( &$out ) {
558 SkinPHPTal::initPage( $out );
559 $this->skinname = "monobook";
560 }
561 }
562
563 ?>